package com.springboot.cloud.system.controller;

import com.springboot.cloud.core.utils.Result;
import com.springboot.cloud.system.service.SystemResourceService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>  </p>
 *
 * @author Bertram
 * @since 11/5/2019 3:29 PM
 */
@RestController
@RequestMapping("/system_resource")
public class SystemResourceController {

    private SystemResourceService systemResourceService;

    public SystemResourceController(SystemResourceService systemResourceService) {
        this.systemResourceService = systemResourceService;
    }

    @GetMapping(value = "/all")
    public Result queryAll() {
        return Result.success(systemResourceService.selectAll());
    }


    @GetMapping(value = "/user/{username}")
    public Result queryUserResource(@PathVariable String username) {
        return Result.success(systemResourceService.selectResourceByUserName(username));
    }
}
